﻿<!--
    Copyright (c) 2012 Nokia Corporation.
-->

<phone:PhoneApplicationPage
    x:Class="FilterEffects.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:FilterEffects"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
	<phone:PhoneApplicationPage.Resources>
		<Storyboard x:Name="CaptureAnimation">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="VideoCanvas">
				<EasingDoubleKeyFrame KeyTime="0" Value="1">
					<EasingDoubleKeyFrame.EasingFunction>
						<BackEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
				<EasingDoubleKeyFrame KeyTime="0:0:0.182" Value="0.835">
					<EasingDoubleKeyFrame.EasingFunction>
						<BackEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
				<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.835">
					<EasingDoubleKeyFrame.EasingFunction>
						<BounceEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="VideoCanvas">
				<EasingDoubleKeyFrame KeyTime="0" Value="0">
					<EasingDoubleKeyFrame.EasingFunction>
						<BackEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
				<EasingDoubleKeyFrame KeyTime="0:0:0.182" Value="63.5">
					<EasingDoubleKeyFrame.EasingFunction>
						<BackEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="VideoCanvas">
				<EasingDoubleKeyFrame KeyTime="0:0:0.182" Value="1"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.979">
					<EasingDoubleKeyFrame.EasingFunction>
						<BounceEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="VideoCanvas">
				<EasingDoubleKeyFrame KeyTime="0:0:0.182" Value="0"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="5">
					<EasingDoubleKeyFrame.EasingFunction>
						<BounceEase EasingMode="EaseOut"/>
					</EasingDoubleKeyFrame.EasingFunction>
				</EasingDoubleKeyFrame>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</phone:PhoneApplicationPage.Resources>
 
    <Grid x:Name="LayoutRoot" Background="Transparent" Margin="0, 0, 0, 0">
       
        <Canvas x:Name="VideoCanvas" RenderTransformOrigin="0.5,0.5" Canvas.ZIndex="0">
            <Canvas.RenderTransform>
                <CompositeTransform/>
            </Canvas.RenderTransform>
            <Canvas.Background>
                <!-- The background contains the camera view finder
                     encapsulated in VideoBrush. -->
                <VideoBrush x:Name="BackgroundVideoBrush" >
                    <VideoBrush.RelativeTransform>
                        <CompositeTransform x:Name="VideoBrushTransform" CenterY="0.5" CenterX="0.5"/>
                    </VideoBrush.RelativeTransform>
                </VideoBrush>
            </Canvas.Background>
        </Canvas>

        <Rectangle x:Name="TitleShade" Height="60" VerticalAlignment="Top" Opacity="0.4" Fill="Black" />
        <phone:Pivot x:Name="TitleText" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}"  />

    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar Opacity="0.4">
            <shell:ApplicationBarIconButton
                x:Name="CaptureButton"
                Text="Capture"
                IconUri="Assets/Graphics/capture-button-icon.png"
                Click="CaptureButton_Click"
                IsEnabled="False" />
            <shell:ApplicationBarIconButton
                x:Name="LoadButton"
                Text="Load"
                IconUri="Assets/Graphics/folder-button-icon.png"
                Click="LoadButton_Click"
                IsEnabled="True" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>